package com.study.money.common;

import lombok.Data;

import java.math.BigDecimal;

/**
 * TODO
 *
 * @author wanghuilong
 * @version 1.0
 * @date 2022/2/14 1:10 下午
 */
@Data
public class ReportDTO {

    /**
     * 时间 交易日数
     */
    private int day;

    /**
     * 估值
     */
    private BigDecimal estimateValue;
    /**
     * 均值
     */
    private BigDecimal meanValue;

    /**
     * 最大值
     */
    private BigDecimal maxValue;

    /**
     * 最小值
     */
    private BigDecimal minValue;

    /**
     * 估值与均值的比例  估值-均值）/ 均值
     */
    private BigDecimal estimateMeanValueRate;


    public ReportDTO(int day, BigDecimal estimateValue, BigDecimal meanValue, BigDecimal maxValue, BigDecimal minValue) {
        this.day = day;
        this.estimateValue = estimateValue;
        this.meanValue = meanValue;
        this.maxValue = maxValue;
        this.minValue = minValue;
        this.estimateMeanValueRate = estimateValue.subtract(meanValue).divide(meanValue, 3);
    }

    public String getEstimateMeanValueRateStr() {
        return this.estimateMeanValueRate.multiply(new BigDecimal(100)).toString()+"%";
    }
}
